﻿using System;
using Autodesk.Revit.DB;

namespace YArchitech.BIM.XRouter
{
	public class Edge
	{
		public Edge(long id, ElementId eleID, long startVertexId, long endVertexID, double weight)
		{
			this.id = id;
			this.elementID = eleID;
			this.fromID = startVertexId;
			this.toID = endVertexID;
			this.weight = weight;
		}

		public long ID
		{
			get
			{
				return this.id;
			}
		}

		public ElementId ElementID
		{
			get
			{
				return this.elementID;
			}
		}

		public long FromID
		{
			get
			{
				return this.fromID;
			}
		}

		public long ToID
		{
			get
			{
				return this.toID;
			}
		}

		public double Weight
		{
			get
			{
				return this.weight;
			}
		}

		public override bool Equals(object obj)
		{
			Edge edge = obj as Edge;
			return edge != null && this.id == edge.ID;
		}

		public long GetMapVertex(long vertexID)
		{
			if (vertexID != this.fromID)
			{
				return this.fromID;
			}
			return this.toID;
		}

		private long id;

		private ElementId elementID;

		private long fromID;

		private long toID;

		private double weight;
	}
}
